package com.gopay.common.cps.dao.bank.impl;

import com.gopay.common.base.dao.impl.BaseDAOImpl;
import com.gopay.common.cps.dao.bank.BisDirectAdPayDAO;
import com.gopay.common.domain.bis.BisDirectAdPayConfig;
import org.springframework.stereotype.Repository;

import java.io.Serializable;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @ClassName: BisDirectAdPayDAOImpl
 * @author sh.jiao
 * @date 2017年10月16日 15:48:47
 */
@Repository("bisDirectAdPayDAO")
public class BisDirectAdPayDAOImpl extends BaseDAOImpl<BisDirectAdPayConfig, Serializable> implements BisDirectAdPayDAO {

    @Override
    public BisDirectAdPayConfig getBisDirectAdPayByBankCodeAndInterfaceCode(String bankCode, String interfaceCode) {
        Map<String,Object> params = new HashMap<String,Object>();
        params.put("bankCode", bankCode);
        params.put("chCode", interfaceCode);
        List<BisDirectAdPayConfig> l = super.findByHql("from BisDirectAdPayConfig where del=0 and bankCode=:bankCode and chCode =:chCode ", params);
        return l.size() > 0 ? l.get(0) : null;
    }

    @Override
    public List<BisDirectAdPayConfig> getBisDirectAdPayConfigByBankCode(String bankCode) {
        Map<String,Object> params = new HashMap<String,Object>();
        params.put("bankCode", bankCode);
        return super.findByHql("from BisDirectAdPayConfig where del=0 and bankCode=:bankCode and enable=1 ", params);
    }

    
}
